home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / mail / netmail_13.lha / NetMail / Drivers / TurboText.reader < prev    next >
Text File  |  1995-08-11  |  3KB  |  141 lines

  1. /*
  2. ** $VER: TurboText.reader 1.3 (11.8.95)
  3. ** Copyright (c) 1995 Riccardo Solmi
  4. **
  5. */
  6.  
  7. OPTIONS RESULTS
  8. OPTIONS FAILAT 21
  9.  
  10. cmd = 'TURBOTEXT:TTX'
  11. IF ~EXISTS(cmd) THEN DO
  12.    cmd = GetVar('NetMail/TurboTextCmd')
  13.    IF cmd = 0 | ~EXISTS(cmd) THEN DO
  14.       ADDRESS COMMAND 'SetEnv NetMail/TurboTextCmd `Which "TTX"`'
  15.       cmd = GetVar('NetMail/TurboTextCmd')
  16.       IF cmd = 0 THEN DO
  17.          ADDRESS COMMAND 'SetEnv NetMail/TurboTextCmd `RequestFile Title "Select TurboText command" Noicons`'
  18.          cmd = GetVar('NetMail/TurboTextCmd')
  19.          IF cmd = 0 | ~EXISTS(cmd) THEN RETURN 2
  20.          ADDRESS COMMAND 'Copy QUIET ENV:NetMail/TurboTextCmd ENVARC:NetMail/TurboTextCmd'
  21.       END
  22.    END
  23. END
  24.  
  25. SELECT
  26.    WHEN UPPER(ARG(1)) = 'READ' THEN DO
  27.       PARSE ARG , file, port
  28.  
  29.       IF ~SHOW('P', port) | ~ABBREV(port, 'TURBOTEXT') THEN DO
  30.          IF ~SHOW('P', 'TURBOTEXT') THEN DO
  31.             ADDRESS COMMAND
  32.             '"'cmd'" >NIL:'
  33.             'WaitForPort TURBOTEXT0'
  34.             IF RC ~= 0 THEN RETURN 5
  35.             port = 'TURBOTEXT0'
  36.          END
  37.          ELSE DO
  38.             ADDRESS 'TURBOTEXT'
  39.             OpenDoc
  40.             port = RESULT
  41.          END
  42.  
  43.          wininfo = GetVar('NetMail/ReaderWin')
  44.          IF wininfo ~= 0 THEN DO
  45.             PARSE VAR wininfo pL pT pW pH .
  46.             ADDRESS VALUE port
  47.             CALL ChangeWindow pL pT pW pH port
  48.          END
  49.       END
  50.       ADDRESS VALUE port
  51.       'SetDisplayLock ON'
  52.       'SetReadOnly ON'
  53.       'OpenFile QUIET NAME' file
  54.       'SetPrefs FindBackward OFF'
  55.       'Find "*N*N"'
  56.       'MoveNextWord'
  57.       'MoveSOL'
  58.       'ScrollView 1'
  59.       'SetDisplayLock OFF'
  60.    END
  61.    WHEN UPPER(ARG(1)) = 'CLEAR' THEN DO
  62.       PARSE ARG , port
  63.  
  64.       IF SHOW('P', port) & ABBREV(port, 'TURBOTEXT') THEN DO
  65.          ADDRESS VALUE port
  66.          'ClearFile'
  67.       END
  68.    END
  69.    WHEN UPPER(ARG(1)) = 'CLOSE' THEN DO
  70.       PARSE ARG , port
  71.  
  72.       IF SHOW('P', port) & ABBREV(port, 'TURBOTEXT') THEN DO
  73.          ADDRESS VALUE port
  74.          wininfo = GetVar('NetMail/ReaderWin')
  75.          PARSE VAR wininfo pL pT pW pH cLTWH
  76.          'GetWindowInfo'
  77.          PARSE VAR RESULT . pL pT pW pH .
  78.          SetVar('NetMail/ReaderWin', pL pT pW pH cLTWH)
  79.          'CloseDoc QUIET'
  80.       END
  81.    END
  82. END
  83. RETURN port
  84.  
  85.  
  86. ChangeWindow:
  87. /** $VER: ChangeWindow.ttx 1.0 (23.12.90)
  88.  **
  89.  ** Unlike the MoveWindow and SizeWindow commands this lets you place and
  90.  ** size a window with absolute, not relative, coordinates. ChangeWindow won't
  91.  ** let you go beyond screen boundaries. The window will be moved then
  92.  ** sized as closely to spec as possible.
  93.  **
  94.  ** Written by Art Steinmetz
  95.  ** Modified by Martin Taillefer
  96.  **/
  97.  
  98.  
  99. PARSE ARG left top width height port
  100.  
  101.  
  102.   port = Strip(port,'B')
  103.  
  104.   IF (port ~= "") THEN DO
  105.     ADDRESS VALUE port
  106.   END
  107.  
  108.   GetWindowInfo
  109.   PARSE VAR RESULT icon winLeft winTop winWidth winHeight minWidth minHeight .
  110.   GetScreenInfo
  111.   PARSE VAR RESULT dum dum scrWidth scrHeight .
  112.  
  113.   IF width > scrWidth THEN DO
  114.     width = scrWidth
  115.   END
  116.  
  117.   IF height > scrHeight THEN DO
  118.     Height = scrHeight
  119.   END
  120.  
  121.   IF left + width > scrWidth THEN DO
  122.     left = scrWidth - width
  123.   END
  124.  
  125.   IF top + height > scrHeight THEN DO
  126.     top = scrHeight - height
  127.   END
  128.  
  129.   IF left < 0 THEN DO
  130.     left = 0
  131.   END
  132.  
  133.   IF top < 0 THEN DO
  134.     top = 0
  135.   END
  136.  
  137.   SizeWindow (minWidth - winWidth) (minHeight - winHeight)
  138.   MoveWindow (left - winLeft) (top - winTop)
  139.   SizeWindow (width - minWidth) (height - minHeight)
  140. RETURN
  141.